<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>验证码</title>
		<style type="text/css">
			.app {
				width: 100%;
				height: 50px;
				padding: 20px 10px;
			}
		</style>
	</head>
	<body bgcolor="#121110">
		<div class="app">
			<!-- <button class="btn" type="button" data-action="navigateBack">返回 </button> -->
		</div>
		<!-- uni 的 SDK -->
		<!-- 需要把 uni.webview.1.5.4.js 下载到自己的服务器 -->
		<script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.3/index.js"></script>
		<script type="text/javascript" src="https://turing.captcha.qcloud.com/TCaptcha.js"></script>
		
		<script>
	
			document.addEventListener('UniAppJSBridgeReady', function() {	//确认是否加载好了TencentCaptcha
				let appid = '192455223'; // 腾讯云控制台中对应这个项目的 appid
				let callback = function(res) {
				//操作验证码后吧回调信息传递给web-view
					uni.postMessage({
						data: {
							res: res
						}
					});
				}
				let captcha = new TencentCaptcha(appid, callback);
				// 滑块显示
				captcha.show();
				document.querySelector('.app').addEventListener('click', function(evt) {
					var target = evt.target;
					if (target.tagName === 'BUTTON') {
						var action = target.getAttribute('data-action');
						switch (action) { 
							case 'navigateBack':
								uni.navigateBack({
									delta: 1
								});
								break;
							default:
								break;
						}
					}
				});
			});
		</script>
	</body>
</html>

